program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type
  pelement = ^element;
  element = record
    value : Integer;
    next : pelement;
  end;
var
  head : pelement;
  a : pelement;
  n : Integer;
  I : Integer;
  q : Integer;
  tmp : pelement;


procedure add_to_begin(x : Integer) ;
begin
  New(a);
  a^.value := x;
  a^.next := head^.next;
  head^.next := a;
end;


procedure write_list() ;
var
  x : pelement;
begin
  x := head;
  while(x <> nil)  do begin
      writeln(x^.value);
      x := x^.next;
  end;
end;


begin
  New(head);
  head := nil;
  Readln(n);
  for I := 0 to n - 1 do begin
      read(q);
      New(tmp);
      if(head = nil) then
        begin
          New(head);
          head^.value := q;
          head^.next := nil;
        end
      else
        begin
          tmp := head;
          New(head);
          head^.value := q;
          head^.next := tmp;
        end;
  end;
  write_list();
  readln;
  Readln;
  Readln;
  Readln;




end.
